<template>
    <!--POP画册、POP下单、道具下单-->
    <view class="page-content">
        <view class="page-top">
            <!-- 标题栏和状态栏占位符 -->
            <view class="titleNview-placing"></view>
            <!-- 标题+筛选 -->
            <w-sel-search topType="two" :col_num="4" label_height="52" :pageobj="pageobj"
                          :popHeight="pageType ==='pop'?'630':pageType ==='prop'?'320':'320'"
                          leftIcon="arrowleft" :cenTit="page_title" cenType="title" iconfont="28" :is_back="false"
                          @back="back"
                          @resetFilterData="resetFilterData" @selectRadioLabel="selectRadioLabel"
                          @setFilterData="setFilterData">
            </w-sel-search>
        </view>
        <scroll-view class="page-body" :scroll-top="scrollTop" scroll-y="true" @scrolltolower="loadmore()">
            <!--产品图片数据-->
            <template v-if="objdata.objlist && objdata.objlist.length > 0 ">
                <view class="body-box">
                    <product-num-edit :obj="objdata.objlist" :list="list2" :is_edit="false" @sel_mats="sel_mats"
                                      @choose="choose"
                                      :delBtnWidth="0" @rednum2="rednum2" @addnum2="addnum2" @addnum1="addnum1"
                                      @rednum1="rednum1"
                                      @addnum0="addnum0" @rednum0="rednum0" @delItem0="delItem0" @confirm="confirm2"
                                      :pageType="pageType">
                    </product-num-edit>
                </view>
                <!-- 上拉加载 -->
                <view class="det-con-more">
                    <load-more :loadmore="load_more1"></load-more>
                </view>
            </template>
            <!--无数据-->
            <empty v-else no-full type="noData"></empty>
        </scroll-view>
		<view class="btn-box" v-if="objdata.objlist.length > 0">
		    <button class="submit" @tap="confirm()">下一步</button>
		</view>
        <!-- <w-popup :show="showtip" :type="type1" @change="change1">
            <view class="w-tip">
                <view class="w-tit">设置定制</view>
                <scroll-view class="w-con" :scroll-top="scrollTop2" scroll-y="true">
                    <view class="w-con-t">材质：</view>
                    <view class="w-con-c">
                        <block v-for="(item,index) in list" :key="index">
                            <view class="w-con-c-li" @click.stop="choose(index)"
                                :style="{background:item.statu?'#CBE6FF':'#f5f5f5',color:item.statu?'#198FFF':'#999'}">
                                {{item.name}}
                            </view>
                        </block>
                    </view>
                </scroll-view>
                <view class="w-but">
                    <view class="w-but-txt" @click.stop="cancel('tip')">取消</view>
                    <view class="w-but-txt" @click.stop="confirm2">确认</view>
                </view>
            </view>
        </w-popup> -->
    </view>
</template>

<script>
    import wSelSearch from '@/components/w-sel-logo/w-sel-search.vue'; //标题
    import loadMore from '@/components/uni-load-more/load-more.vue';
    import productNumEdit from '@/pages/components/product_num_edit2.vue';
    import wPopup from '@/components/w-popup/w-popup2.vue';
    import {
        mapGetters,
        mapActions
    } from "vuex";
    import {
        taskDataInfos, //获取任务详情
        getFlowLists, //获取流程
        getProductCodingLists, //pop列表
        saveTaskDatas, //保存
        editTasks, //编辑流程
        getOssUploadsParams,
        getProductAttrLists, //获取产品属性列表
        getProductTextureLists, //材质列表
        orderInfos, //订单详情

    } from '@/common/api.js';

    export default {
        components: {
            loadMore,
            productNumEdit,
            wSelSearch,
            wPopup
        },
        data() {
            return {
                page_title: '',
                pageobj: {
                    name: '单选',
                    type: 'radio',
                    submenu: []
                },
                scrollTop: 0,
                noData: false,
                load_more1: '', //下拉加载文字
                objdata: {
                    id: 1,
                    image: '/static/data-img/img.jpg',
                    title: '任务名任务名任务名任务名',
                    flowname: '',
                    datalist: [],
                    objlist: []
                },
                list2: [],

                sel_img_index: 0, //选择当前项
                params: {
                    id: '',
                    company_id: '',
                    product_attr_id: [],
                    product_coding_id: []
                },
                pageType: '',
                pagedata: {
                    company_id: '',
                    top_id: '',
                    type: ''
                },
                list: [],
                scrollTop2: 0,
                sel_ind: 0,
                showtip: false, //是否显示弹窗1
                content1: '顶部弹 popup',
                type1: '', //弹窗显示方式
                order_id: '',
                jsondata: '',
                order_list: [],
            }
        },
        computed: {
            ...mapGetters(['companyInfo', 'userInfo']),
        },
        onShow() {

        },
        onLoad(option) {
            console.log(222, option)
            this.params.company_id = this.companyInfo.id;
            this.pagedata.company_id = this.companyInfo.id;
            if (!!option.title) {
                this.page_title = option.title;
            }
            if (option.id) {
                this.params.id = option.id;
            }

            if (option.pageType) {
                this.pageType = option.pageType;
                if (option.order_id) {
                    this.order_id = option.order_id;
                    //this.getdata3(); //获取再下一单的数据
                }
                this.getdata();
            }
            this.getdata2();
            if (option.flow_path_id) {
                this.objdata.flow_path_id = option.flow_path_id;
            }

        },
        methods: {
            //材质删除
            delItem0(index, ind) {
                if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                    this.objdata.objlist.forEach((item, i) => {
                        if (index === i) {
                            let list = item.textures
                            delete list[ind]
                            item.textures = list.filter(Boolean)
                        }
                    })
                }
            },
            //材质减少数量
            rednum0(index, ind) {
                if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                    this.objdata.objlist.forEach((item, i) => {
                        if (index === i) {
                            if (item.textures && item.textures.length > 0) {
                                item.textures.forEach((item2, ii) => {
                                    if (ind === ii) {
                                        if (item2.number > 0) {
                                            item2.number -= 1
                                        }
                                    }
                                })
                            }
                        }
                    })
                }
            },
            //材质增加数量
            addnum0(index, ind) {
                console.log('材质增加', index, ind)
                console.log(1112, this.objdata.objlist)
                /* if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                    this.objdata.objlist.forEach((item, i) => {
                        if (index === i) {
                            if (item.textures && item.textures.length > 0) {
                                item.textures.forEach((item2, ii) => {
                                    if (ind === ii) {
                                        console.log(1111,item2)
                                        item2.number += 1
                                    }
                                })
                            }
                        }
                    })
                } */
                let resData = this.objdata.objlist;
                if (resData && resData.length > 0) {
                    for (let i = 0; i < resData.length; i++) {
                        if (i === index) {
                            for (let ii = 0; ii < resData[i].textures.length; ii++) {
                                if (ii === ind) {
                                    resData[i].textures[ii].number += 1;
                                }
                            }
                        }
                    }
                }
            },
            //确认材质
            confirm2() {
                console.log(1111, this.objdata.objlist)
                let resdata = this.objdata.objlist.map((item) => ({
                    ...item
                }))
                const list = this.list2;
                let textures = [];
                if (list && list.length > 0) {
                    list.forEach(item => {
                        if (item.statu) {
                            textures.push(item)
                        }
                    })
                }
                resdata[this.sel_ind].textures = textures;
                this.objdata.objlist = resdata;
                this.showtip = false;
            },
            //选择材质
            choose(index) {
                if (this.list2 && this.list2.length > 0) {
                    this.list2.forEach((item, ind) => {
                        if (index === ind) {
                            item.statu = true
                        }
                    })
                }
            },
            //选择材质
            sel_mats(index) {
                this.sel_ind = parseInt(index);
                //材质
                getProductTextureLists({company_id: this.params.company_id}).then(res => {
                    if (res.code === 2000) {
                        const data = res.data.map((item) => ({
                            name: item.name,
                            statu: false,
                            width: '',
                            height: '',
                            number: 0,
                            texture_name: item.name,
                            texture_id: item.id
                        }))
                        this.list2 = data;
                        if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                            this.objdata.objlist.forEach((item, index) => {
                                if (index === parseInt(this.sel_ind)) {
                                    if (item.textures && item.textures.length > 0) {
                                        item.textures.forEach((item2, index2) => {
                                            if (this.list2 && this.list2.length > 0) {
                                                this.list2.forEach((ite, ind) => {
                                                    if (item2.id === ite.id) {
                                                        ite.statu = true
                                                    }
                                                })
                                            }
                                        })
                                    }
                                }
                            })
                        }
                    }
                })

                // this.content1 = 'center'
                // this.type1 = 'center';
                // this.showtip = true;
            },
            getdata2() {
                if (this.pageType === 'pop') { //pop
                    this.pagedata.top_id = 0;
                    this.pagedata.type = 1;
                    getProductCodingLists(this.pagedata).then(res => {
                        if (res.code === 2000) {
                            let pageobj = {
                                type: 'radio',
                                submenu: [],
                            }
                            let submenu = {
                                type: 'one',
                                submenu: [],
                            }
                            submenu.submenu = res.data;
                            if (submenu.submenu && submenu.submenu.length > 0) {
                                submenu.submenu.forEach(item => {
                                    this.$set(item, 'selected', false);
                                })
                            }
                            pageobj.submenu.push(submenu);
                            getProductAttrLists(this.pagedata).then(res => {
                                if (res.code === 2000) {
                                    let submenu2 = res.data;
                                    if (submenu2 && submenu2.length > 0) {
                                        submenu2.forEach(item2 => {
                                            this.$set(item2, 'submenu', Array);
                                            this.$set(item2, 'type', 'two');
                                            this.pagedata.top_id = item2.id;
                                            getProductAttrLists(this.pagedata).then(res2 => {
                                                if (res2.code === 2000) {
                                                    this.$nextTick(() => {
                                                        item2.submenu = res2.data;
                                                        if (item2.submenu && item2
                                                            .submenu.length > 0) {
                                                            item2.submenu.forEach(
                                                                item3 => {
                                                                    this.$set(
                                                                        item3,
                                                                        'selected',
                                                                        false
                                                                    )
                                                                })
                                                        }
                                                    })
                                                }
                                            })
                                        })
                                    }
                                    if (submenu2 && submenu2.length > 0) {
                                        submenu2.forEach(item4 => {
                                            pageobj.submenu.push(item4);
                                        })
                                    }
                                    this.pageobj = pageobj;
                                    console.log(555, pageobj)
                                }
                            })
                        }
                    })
                } else if (this.pageType === 'prop') { //prop
                    this.pagedata.top_id = 0;
                    this.pagedata.type = 2;
                    getProductCodingLists(this.pagedata).then(res => {
                        if (res.code === 2000) {
                            let pageobj = {
                                type: 'radio',
                                submenu: [],
                            }
                            let submenu = {
                                type: 'one',
                                submenu: [],
                            }
                            submenu.submenu = res.data;
                            if (submenu.submenu && submenu.submenu.length > 0) {
                                submenu.submenu.forEach(item => {
                                    this.$set(item, 'selected', false);
                                })
                            }
                            pageobj.submenu.push(submenu);
                            this.pageobj = pageobj;
                        }
                    })
                }
            },
            getdata3() {

                taskDataInfos(this.params).then(res => {
                    if (res.code === 2000) {
                        this.page_title = res.data.title;
                        this.objdata.title = res.data.title;
                        this.objdata.img = res.data.img;
                        this.objdata.id = res.data.id;
                        this.objdata.type = res.data.type;
                        this.objdata.flow_path_id = res.data.flow_path_id;
                        let objlist = []
                        if (!!this.order_id) { //再下一单数据获取

                            console.log(777, this.order_list)
                            if (this.order_list && this.order_list.length > 0) {
                                this.order_list.forEach(item => {
                                    let datalist = [];
                                    let textures = [];
                                    this.$set(item, 'datalist', datalist)
                                    this.$set(item, 'textures', textures)
                                    this.$set(item, 'img_name', item.img_name)
                                    this.$set(item, 'delete', 2)
                                    this.$set(item, 'id', item.task_album_join_id)
                                    this.$set(item, 'url', item.img_url)
                                    this.$set(item, 'attr_data', item.attr)
                                    if (item.data && item.data.length > 0) {
                                        item.data.forEach(item2 => {
                                            this.$set(item2, 'delete', 2)
                                            this.$set(item2, 'id', item2.task_data_id)
                                            console.log(1111, item2)
                                            if (item2.width === '0.00') {
                                                item2.width = ''
                                            }
                                            if (item2.height === '0.00') {
                                                item2.height = ''
                                            }
                                            if (item2.coding_name !== '定制') {
                                                if (item2.top_id === 0) {
                                                    item.datalist.push(item2)
                                                    let data = [];
                                                    let texture = [];
                                                    this.$set(item2, 'number', 0)
                                                    this.$set(item2, 'data', data)
                                                    this.$set(item2, 'texture', texture)
                                                    if (item.datalist && item.datalist.length > 0) {
                                                        item.datalist.forEach(item3 => {
                                                            if (item2.top_id === item3.product_coding_id) {
                                                                item3.data.push(item2)
                                                                item3.texture.push(item2.texture_name)
                                                            }
                                                        })
                                                    }
                                                }
                                            } else if (item2.coding_name === '定制') {
                                                item.textures.push(item2)
                                            }

                                        })
                                    }
                                    if (item.data && item.data.length > 0) {
                                        item.data.forEach(item2 => {
                                            if (item.datalist && item.datalist.length > 0) {
                                                item.datalist.forEach(item3 => {
                                                    if (item2.top_id === item3.product_coding_id) {
                                                        item3.data.push(item2)
                                                        item3.texture.push(item2.texture_name)
                                                    }
                                                    if (item3.data && item3.data.length > 0) {
                                                        item3.data.forEach(item4 => {
                                                            let data = [];
                                                            this.$set(item4, 'data', data)
                                                        })
                                                    }
                                                })
                                            }
                                        })
                                    }
                                    if (item.data && item.data.length > 0) {
                                        item.data.forEach(item2 => {
                                            if (item.datalist && item.datalist.length > 0) {
                                                item.datalist.forEach(item3 => {
                                                    if (item3.data && item3.data.length > 0) {
                                                        item3.data.forEach(item4 => {
                                                            if (item2.top_id === item4.product_coding_id) {
                                                                item4.data.push(item2);
                                                                item3.texture.push(item2.texture_name) //增加材质
                                                            }
                                                        })
                                                    }
                                                })
                                            }
                                        })
                                    }
                                    objlist.push(item);
                                })
                            }


                            /* console.log(888,this.jsondata)
                             if(this.jsondata.task_data && this.jsondata.task_data.length>0){
                                 this.jsondata.task_data.forEach(item=>{
                                     let datalist = []
                                     let textures = []
                                     this.$set(item, 'datalist', datalist)
                                     this.$set(item, 'textures', textures)
                                    this.$set(item, 'id', item.task_album_join_id)
                                     if(item.data && item.data.length>0){
                                         item.data.forEach(item2=>{
                                             console.log(1111,item2)
                                             this.$set(item2,'texture_id','')
                                             if(item2.width === '0.00'){
                                                 item2.width = ''
                                             }
                                             if(item2.height === '0.00'){
                                                 item2.height = ''
                                             }
                                             if (item2.top_id === 0 && item2.statu === undefined) {
                                                 item.datalist.push(item2)
                                                 let data = [];
                                                 let texture = [];
                                                 this.$set(item2, 'data', data)
                                                 this.$set(item2, 'texture', texture)
                                                 if(item.datalist && item.datalist.length>0){
                                                     item.datalist.forEach(item3=>{
                                                         if (item2.top_id === item3.product_coding_id) {
                                                             item3.data.push(item2)
                                                             item3.texture.push(item2.texture_name)
                                                         }
                                                     })
                                                 }
                                             }else if(item2.top_id === 0 && (!!item2.statu)){
                                                item.textures.push(item2)
                                            }

                                         })
                                     }
                                     if(item.data && item.data.length>0){
                                         item.data.forEach(item2=>{
                                             if(item.datalist && item.datalist.length>0){
                                                 item.datalist.forEach(item3=>{
                                                     if (item2.top_id === item3.product_coding_id) {
                                                         item3.data.push(item2)
                                                         item3.texture.push(item2.texture_name)
                                                     }
                                                     if(item3.data && item3.data.length>0){
                                                         item3.data.forEach(item4=>{
                                                             let data = [];
                                                             this.$set(item4, 'data', data)
                                                         })
                                                     }
                                                 })
                                             }
                                         })
                                     }
                                     if(item.data && item.data.length>0){
                                         item.data.forEach(item2=>{
                                             if(item.datalist && item.datalist.length>0){
                                                 item.datalist.forEach(item3=>{
                                                     if(item3.data && item3.data.length>0){
                                                         item3.data.forEach(item4=>{
                                                             if (item2.top_id === item4.product_coding_id) {
                                                                 item4.data.push(item2);
                                                                 item3.texture.push(item2.texture_name) //增加材质
                                                             }
                                                         })
                                                     }
                                                 })
                                             }
                                         })
                                     }
                                     objlist.push(item);
                                 })
                             } */

                            /* orderInfos({order_id:this.order_id}).then(res=>{
                                if(res.code === 2000){
                                    const {order_flow,order_list,jsondata} = res.data;
                                    this.jsondata = jsondata;
                                    let objlist = []
                                    if(order_list && order_list.length>0){
                                        order_list.forEach(item=>{
                                            let datalist = [];
                                            let textures = [];
                                            this.$set(item, 'datalist', datalist)
                                            this.$set(item, 'textures', textures)
                                            this.$set(item, 'img_name', item.img_name)
                                            this.$set(item, 'delete',2)
                                            this.$set(item, 'attr_data',item.attr)
                                            if(item.data && item.data.length>0){
                                                item.data.forEach(item2=>{
                                                    this.$set(item2,'delete',2)
                                                    console.log(1111,item2)
                                                    if(item2.width === '0.00'){
                                                        item2.width = ''
                                                    }
                                                    if(item2.height === '0.00'){
                                                        item2.height = ''
                                                    }
                                                    if(item2.coding_name !== '定制'){
                                                        if (item2.top_id === 0) {
                                                            item.datalist.push(item2)
                                                            let data = [];
                                                            let texture = [];
                                                            this.$set(item2,'number',0)
                                                            this.$set(item2, 'data', data)
                                                            this.$set(item2, 'texture', texture)
                                                            if(item.datalist && item.datalist.length>0){
                                                                item.datalist.forEach(item3=>{
                                                                    if (item2.top_id === item3.product_coding_id) {
                                                                        item3.data.push(item2)
                                                                        item3.texture.push(item2.texture_name)
                                                                    }
                                                                })
                                                            }
                                                        }
                                                    }else if(item2.coding_name === '定制'){
                                                        item.textures.push(item2)
                                                    }

                                                })
                                            }
                                            if(item.data && item.data.length>0){
                                                item.data.forEach(item2=>{
                                                    if(item.datalist && item.datalist.length>0){
                                                        item.datalist.forEach(item3=>{
                                                            if (item2.top_id === item3.product_coding_id) {
                                                                item3.data.push(item2)
                                                                item3.texture.push(item2.texture_name)
                                                            }
                                                            if(item3.data && item3.data.length>0){
                                                                item3.data.forEach(item4=>{
                                                                    let data = [];
                                                                    this.$set(item4, 'data', data)
                                                                })
                                                            }
                                                        })
                                                    }
                                                })
                                            }
                                            if(item.data && item.data.length>0){
                                                item.data.forEach(item2=>{
                                                    if(item.datalist && item.datalist.length>0){
                                                        item.datalist.forEach(item3=>{
                                                            if(item3.data && item3.data.length>0){
                                                                item3.data.forEach(item4=>{
                                                                    if (item2.top_id === item4.product_coding_id) {
                                                                        item4.data.push(item2);
                                                                        item3.texture.push(item2.texture_name) //增加材质
                                                                    }
                                                                })
                                                            }

                                                        })
                                                    }
                                                })
                                            }
                                            objlist.push(item);
                                        })
                                    }
                                    this.objdata.objlist = objlist;
                                    console.log(88888,this.objdata.objlist)
                                    //this.$forceUpdate() //二维数组，开启强制渲染
                                }
                            }) */


                        } else { //pop下单数据
                            if (res.data.dataList && res.data.dataList.length > 0) {
                                res.data.dataList.forEach(item => {
                                    let datalist = []
                                    let textures = []
                                    this.$set(item, 'datalist', datalist)
                                    this.$set(item, 'textures', textures)
                                    if (item.data && item.data.length > 0) {
                                        item.data.forEach(item2 => {
                                            console.log(1111, item2)
                                            this.$set(item2, 'texture_id', '')
                                            if (item2.width === '0.00') {
                                                item2.width = ''
                                            }
                                            if (item2.height === '0.00') {
                                                item2.height = ''
                                            }
                                            if (item2.top_id === 0) {
                                                item.datalist.push(item2)
                                                let data = [];
                                                let texture = [];
                                                this.$set(item2, 'data', data)
                                                this.$set(item2, 'texture', texture)
                                                if (item.datalist && item.datalist.length > 0) {
                                                    item.datalist.forEach(item3 => {
                                                        if (item2.top_id === item3.product_coding_id) {
                                                            item3.data.push(item2)
                                                            item3.texture.push(item2.texture_name)
                                                        }
                                                    })
                                                }
                                            }
                                        })
                                    }
                                    if (item.data && item.data.length > 0) {
                                        item.data.forEach(item2 => {
                                            if (item.datalist && item.datalist.length > 0) {
                                                item.datalist.forEach(item3 => {
                                                    if (item2.top_id === item3.product_coding_id) {
                                                        item3.data.push(item2)
                                                        item3.texture.push(item2.texture_name)
                                                    }
                                                    if (item3.data && item3.data.length > 0) {
                                                        item3.data.forEach(item4 => {
                                                            let data = [];
                                                            this.$set(item4, 'data', data)
                                                        })
                                                    }
                                                })
                                            }
                                        })
                                    }
                                    if (item.data && item.data.length > 0) {
                                        item.data.forEach(item2 => {
                                            if (item.datalist && item.datalist.length > 0) {
                                                item.datalist.forEach(item3 => {
                                                    if (item3.data && item3.data.length > 0) {
                                                        item3.data.forEach(item4 => {
                                                            if (item2.top_id === item4.product_coding_id) {
                                                                item4.data.push(item2);
                                                                item3.texture.push(item2.texture_name) //增加材质
                                                            }
                                                        })
                                                    }
                                                })
                                            }
                                        })
                                    }
                                    objlist.push(item);
                                })
                            }

                        }

                        this.objdata.objlist = objlist;
                        console.log(44444, this.objdata.objlist)
                        //流程
                        getFlowLists({
                            company_id: res.data.company_id
                        }).then(res2 => {
                            if (res2.code === 2000) {
                                if (res2.data && res2.data.length > 0) {
                                    res2.data.forEach(item => {
                                        if (res.data.flow_path_id === item.id) {
                                            this.objdata.flowname = item.title;
                                        }
                                    })
                                }
                            }
                        })
                    }
                })


            },
            resdata4() {
                this.getdata();
            },
            getdata() {
                if (!!this.order_id) {
                    orderInfos({order_id: this.order_id}).then(res => {
                        console.log(110, res)
                        if (res.code === 2000) {
                            const {order_flow, order_list, jsondata} = res.data;
                            this.jsondata = JSON.parse(jsondata);
                            this.params.id = this.jsondata.task_id;
                            this.order_list = order_list;
                            this.getdata3();
                        }
                    })
                } else {
                    this.getdata3();
                }
            },
            rednum1(sel_img_index, index, index2) {
                if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                    this.objdata.objlist.forEach((item, i) => {
                        if (sel_img_index === i) {
                            if (item.datalist && item.datalist.length > 0) {
                                item.datalist.forEach((item2, ii) => {
                                    if (index === ii) {
                                        if (item2.data && item2.data.length > 0) {
                                            item2.data.forEach((item3, iii) => {
                                                if (index2 === iii) {
                                                    if (item3.number > 0) {
                                                        item3.number -= 1
                                                    }
                                                }
                                            })
                                        }
                                    }
                                })
                            }
                        }
                    })
                }
            },
            addnum1(sel_img_index, index, index2) {
                console.log('一级增加', index, index2)
                if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                    this.objdata.objlist.forEach((item, i) => {
                        if (sel_img_index === i) {
                            if (item.datalist && item.datalist.length > 0) {
                                item.datalist.forEach((item2, ii) => {
                                    if (index === ii) {
                                        if (item2.data && item2.data.length > 0) {
                                            item2.data.forEach((item3, iii) => {
                                                if (index2 === iii) {
                                                    item3.number += 1
                                                }
                                            })
                                        }
                                    }
                                })
                            }
                        }
                    })
                }
            },
            rednum2(sel_img_index, index, index2, index3) {
                if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                    this.objdata.objlist.forEach((item, i) => {
                        if (sel_img_index === i) {
                            if (item.datalist && item.datalist.length > 0) {
                                item.datalist.forEach((item2, ii) => {
                                    if (index === ii) {
                                        if (item2.data && item2.data.length > 0) {
                                            item2.data.forEach((item3, iii) => {
                                                if (index2 === iii) {
                                                    if (item3.data && item3.data.length > 0) {
                                                        item3.data.forEach((item4, iiii) => {
                                                            if (index3 === iiii) {
                                                                if (item4.number > 0) {
                                                                    item4.number -= 1
                                                                }
                                                            }
                                                        })
                                                    }
                                                }
                                            })
                                        }
                                    }
                                })
                            }
                        }
                    })
                }
            },
            addnum2(sel_img_index, index, index2, index3) {
                console.log('二级增加', index, index2, index3)
                if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                    this.objdata.objlist.forEach((item, i) => {
                        if (sel_img_index === i) {
                            if (item.datalist && item.datalist.length > 0) {
                                item.datalist.forEach((item2, ii) => {
                                    if (index === ii) {
                                        if (item2.data && item2.data.length > 0) {
                                            item2.data.forEach((item3, iii) => {
                                                if (index2 === iii) {
                                                    if (item3.data && item3.data.length > 0) {
                                                        item3.data.forEach((item4, iiii) => {
                                                            if (index3 === iiii) {
                                                                item4.number += 1
                                                            }
                                                        })
                                                    }
                                                }
                                            })
                                        }
                                    }
                                })
                            }
                        }
                    })
                }
            },
            //下一步
            confirm() {
                console.log(88888, this.objdata.objlist);

                let past = true;
                if (this.pageType === 'pop') {
                    if (this.objdata.objlist && this.objdata.objlist.length > 0) {
                        this.objdata.objlist.forEach(item => {
                            if (item.textures && item.textures.length > 0) {
                                item.textures.forEach((ite, ii) => {
                                    if (ite.number > 0) {
                                        if (ite.width === '' || ite.height === '') {
                                            //console.log(9999, ite)
                                            uni.showToast({
                                                title: '请输入已增加数量的产品尺寸！',
                                                icon: 'none',
                                                duration: 2000
                                            })
                                            past = false
                                        }
                                    }
                                })
                            }
                            if (item.datalist && item.datalist.length > 0) {
                                item.datalist.forEach(item2 => {
                                    if (item2.data && item2.data.length > 0) {
                                        item2.data.forEach(item3 => {
                                            if (item3.has_next === 0) {
                                                if (item3.number > 0) {
													item3.width = parseInt(item3.width);
													item3.height = parseInt(item3.height);
                                                    if (item3.width === 0 || item3.height === 0) {
                                                        //console.log(9999, item3)
                                                        uni.showToast({
                                                            title: '请输入已增加数量的产品尺寸！',
                                                            icon: 'none',
                                                            duration: 2000
                                                        })
                                                        past = false
                                                    }
                                                }
                                            } else if (item3.has_next === 1) {
                                                if (item3.data && item3.data.length > 0) {
                                                    item3.data.forEach(item4 => {
                                                        if (item4.number > 0) {
															item4.width = parseInt(item4.width);
															item4.height = parseInt(item4.height);
                                                            if (item4.width === 0 || item4.height === 0) {
                                                                uni.showToast({
                                                                    title: '请输入已增加数量的产品尺寸！',
                                                                    icon: 'none',
                                                                    duration: 2000
                                                                })
                                                                past = false
                                                            }
                                                        }
                                                    })
                                                }
                                            }
                                        })
                                    }
                                })
                            }
                        })
                    }
                }
				//console.log(111,this.objdata)
                if (past) {
                    uni.navigateTo({
                        url: `/pages/order/PopConfirmOrder?pageType=${this.pageType}&objdata=${JSON.stringify(this.objdata)}`
                    })
                }
            },
            //返回
            back() {
                uni.navigateBack({
                    delta: 1
                })
            },
            //重置筛选
            resetFilterData() {

            },
            //确认筛选
            setFilterData() {
				console.log('dsfasdfasdfasdfs')
                let product_attr_id = [];
                let product_coding_id = [];
                if (this.pageobj.submenu && this.pageobj.submenu.length > 0) {
                    this.pageobj.submenu.forEach(item => {
                        if (item.type === 'one') {
                            if (item.submenu && item.submenu.length > 0) {
                                item.submenu.forEach(item2 => {
                                    if (item2.selected) {
                                        product_coding_id.push(item2.id)
                                    }
                                })
                            }
                        }
                        if (item.type === 'two') {
                            if (item.submenu && item.submenu.length > 0) {
                                item.submenu.forEach(item2 => {
                                    if (item2.selected) {
                                        product_attr_id.push(item2.id)
                                    }
                                })
                            }
                        }
                    })
                }
                console.log(22, product_attr_id, product_coding_id)
                this.params.product_attr_id = product_attr_id;
                this.params.product_coding_id = product_coding_id;
                this.getdata();
            },
            //点击筛选
            selectRadioLabel(index, ind, selected) {
                console.log(11, index, ind, selected)
                if (this.pageobj.submenu && this.pageobj.submenu.length > 0) {
                    this.pageobj.submenu.forEach((item, i) => {
                        if (item.type === 'one') {
                            if (index === i) {
                                if (item.submenu && item.submenu.length > 0) {
                                    item.submenu.forEach((item2, ii) => {
                                        if (ind === ii) {
                                            item2.selected = !selected;
                                        }
                                    })
                                }
                            }
                        } else if (item.type === 'two') {
                            if (index === i) {
                                if (item.submenu && item.submenu.length > 0) {
                                    item.submenu.forEach((item2, ii) => {
                                        if (ind === ii) {
                                            item2.selected = !selected;
                                        }/* else {
                                            item2.selected = false; //单选
                                        } */
                                    })
                                }
                            }
                        }
                    })
                }
            },
            change1(e) {
                if (!e.show) {
                    this.showtip = false;
                }
            },
            //取消
            cancel(type) {
                this['show' + type] = false
            },
            loadmore() {

            },
        }
    }
</script>

<style lang="scss">
    /* 提示窗口 */
    .w-tip2 {
        /* #ifndef APP-NVUE */
        display: flex;
        flex-direction: column;
        /* #endif */
        width: 70vw;
        border-radius: 10 rpx;
        background-color: #fff;
        box-shadow: 0 rpx 7 rpx 7 rpx 0 rpx rgba(0, 0, 0, 0.1);
        margin: 30 rpx auto 0;

        .w-tit {
            font-size: 36 rpx;
            font-weight: bold;
            color: $font-color-3;
            line-height: 60 rpx;
            height: 60 rpx;
            margin-top: 20 rpx;
            text-align: center;
        }

        .w-but {
            display: flex;
            font-size: 32 rpx;
            font-weight: 400;
            color: $font-color-b3;
            height: 84 rpx;
            line-height: 84 rpx;

            .w-but-txt {
                flex: 1;
                text-align: center;
                border-right: 1 rpx solid #f5f5f5;
            }

            .w-but-txt:last-of-type {
                border-right: none;
            }
        }

        .w-con {
            display: flex;
            text-align: center;
            font-weight: 400;
            padding: 30 rpx 30 rpx;
            border-bottom: 1 rpx solid #f5f5f5;

            .txt-row {
                width: 100%;
                text-align: center;
                font-size: 28 rpx;
                color: $font-color-9;
            }

            .txt-input {
                border: 1 rpx solid #f5f5f5;
                height: 60 rpx;
                width: 100%;
            }
        }
    }

    /* 提示窗口 */
    .w-tip {
        /* #ifndef APP-NVUE */
        display: flex;
        flex-direction: column;
        /* #endif */
        width: 80vw;
        min-height: 300 rpx;
        border-radius: 10 rpx;
        background-color: #fff;
        box-shadow: 0 rpx 7 rpx 7 rpx 0 rpx rgba(0, 0, 0, 0.1);
        margin: 30 rpx auto 0;

        .w-tit {
            font-size: 36 rpx;
            font-weight: bold;
            color: $font-color-3;
            line-height: 90 rpx;
            height: 90 rpx;
            text-align: center;
            border-bottom: 1 rpx solid #f5f5f5;
        }

        .w-but {
            display: flex;
            font-size: 32 rpx;
            font-weight: 400;
            color: $font-color-b3;
            height: 84 rpx;
            line-height: 84 rpx;

            .w-but-txt {
                flex: 1;
                text-align: center;
                border-right: 1 rpx solid #f5f5f5;
            }

            .w-but-txt:last-of-type {
                border-right: none;
            }
        }

        .w-con {
            display: flex;
            flex-direction: column;
            height: 400 rpx;
            font-size: 32 rpx;
            font-weight: 400;
            color: $font-color-3;
            border-bottom: 1 rpx solid #f5f5f5;

            .w-con-t {
                font-size: 28 rpx;
                font-weight: 400;
                color: $font-color-3;
                padding: 10 rpx 30 rpx;
            }

            .w-con-c {
                display: flex;
                flex-wrap: wrap;
                padding: 10 rpx 30 rpx;

                .w-con-c-li {
                    height: 52 rpx;
                    line-height: 52 rpx;
                    padding: 0 20 rpx;
                    margin: 0 20 rpx 20 rpx 0;
                    border-radius: 6 rpx;
                    font-size: 28 rpx;
                    font-weight: 400;
                }
            }
        }
    }

    /* 提示窗口 */
    .w-tip3 {
        /* #ifndef APP-NVUE */
        display: flex;
        flex-direction: column;
        /* #endif */
        width: 100vw;
        min-height: 100 rpx;
        border-radius: 20 rpx 20 rpx 0px 0px;
        background-color: #fff;
        box-shadow: 0 rpx 7 rpx 7 rpx 0 rpx rgba(0, 0, 0, 0.1);
        padding: 20 rpx 0 rpx;
        margin: 30 rpx auto 0;

        .w-con {
            line-height: 100 rpx;
            font-size: 32 rpx;
            font-weight: 400;
            color: $font-color-3;
            text-align: center;

            .w-con-txt {
                border-bottom: 1 rpx solid #f5f5f5;
            }

            .w-con-cen {
                color: #198FFF;
            }
        }
    }

    .titleNview-placing {
        height: var(--status-bar-height);
        box-sizing: content-box;
        background: $uni-bg-color;
        display: block;
        position: sticky;
        top: 0 rpx;
        z-index: 9999;
        overflow: hidden
    }

    .page-content {
        border-top: 1 rpx solid #f5f5f5;
        width: 100vw;
        height: 100%;
        background: $uni-bg-color-grey;

        .page-top {
            display: flex;
            flex-direction: column;
            box-sizing: content-box;
            background: $uni-bg-color;
            display: block;
            position: sticky;
            top: 0 rpx;
            z-index: 9999;
            border-bottom: 1 rpx solid #f5f5f5;
        }
		.btn-box {
		    width: 100%;
		    position: fixed;
			z-index: 999;
		    left: 0;
		    right: 0;
		    bottom: 0;
		    height: 90 rpx;
		    font-size: 36 rpx;
		    line-height: 90 rpx;
		    color: white;

		    .submit {
		        text-align: center;
		        border-radius: 0 !important;
		        color: white !important;
		        background-color: #198FFF;
		    }
		}
        .page-body {
            display: flex;
            height: calc(100% - 180rpx - var(--status-bar-height));
            padding: 0;

            .body-box {
                display: flex;
                flex-direction: column;
                background: $uni-bg-color;
                padding-bottom: 40rpx;

            }

        }
    }
</style>
